import { Component } from '@angular/core';
import { NavController,NavParams,ViewController} from 'ionic-angular';
;
@Component({
  selector: 'page-publish-sport',
  templateUrl: 'publish-sport.html',
})
export class PublishSport {

	startTime: String ;//获取当前系统时间,也是开始时间(数据双向绑定)
	endTime:String;//设置结束时间
	min:String;//最小时间(为当前时间，注意一个问题，Angular是双向绑定数据，所以不能直接等于now)
	max:String;//最大时间(为now+7天)
	isModifyTel:false;
	// pubSport: FormGroup;
	// // startTime: any;
	// // endTime: any;

  constructor(
  	public navCtrl: NavController,
  	public navParams: NavParams,
    public  viewCtrl: ViewController) {
  	this.startTime = this.calculateTime('+8');
  	this.endTime = this.calculateTime('+8');
  	this.min = this.calculateTime('+8');
  	this.max = this.calculateTime('+176');//一周为168小时+8校准时间

  }
  	//时间标准化
   calculateTime(offset: any) {
    let d = new Date();
    let nd = new Date(d.getTime() + (3600000 * offset));
    return nd.toISOString();
  }
 test(){
 	console.log("开始时间为:"+this.startTime);
 	console.log("结束时间为:"+this.endTime);
 }
  // 关闭当前页面
  dismiss() {
    this.viewCtrl.dismiss();
  }
}
